import {createStore,applyMiddleware} from 'redux';
import thunk from 'redux-thunk';
let initState={
  token:"",
  list:[]
}
let reducer=(state=initState,actions)=>{
  switch(actions.type){
    case 'SET_LIST':
      state.list=actions.data;
      break;

    case 'SET_TOKEN':
      state.token=actions.data;
      sessionStorage.setItem('token',actions.data);
      break;
      default:

  }

  return JSON.parse(JSON.stringify(state));
}

export default createStore(reducer,applyMiddleware(thunk));